/*
 * Copyright (C) 2009 AnK Team
 *	 Andrey Korolev
 *	 Anna Krel
 *	 Anna Kapanina
 *	 
 *	 http://code.google.com/p/ankfood/	
 *    
     
 *    Licensed under the GNU General Public License, Version 2.0 (the "License");
 *
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *         http://www.gnu.org/licenses/gpl-2.0.html

 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,

 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */



package org.ank.food;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class LicenceActivity extends Activity{
	
	private Button acceptButton;
	private static final String PREFS_LICENCE_ACCEPTED = "lic acc";
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.licence_activity);
        if( getPreferences(0).getBoolean(PREFS_LICENCE_ACCEPTED, false) ){
        	Intent intent = new Intent();
    		intent.setClass(getApplicationContext(), LaunchActivity.class);
    		startActivity(intent);
    		finish();
        }
        	
        acceptButton = (Button)findViewById(R.id.licence_accept_button);
        acceptButton.setOnClickListener(new Button.OnClickListener(){
			@Override
			public void onClick(View arg0) {
				SharedPreferences.Editor editor = getPreferences(0).edit();
				editor.putBoolean(PREFS_LICENCE_ACCEPTED, true);
				editor.commit();
				Intent intent = new Intent();
        		intent.setClass(getApplicationContext(), LaunchActivity.class);
        		startActivity(intent);
        		finish();
			}
        });
	}
	

}
